#pragma once

#include <stdio.h>
#include "HY1C_out.h"

#define SENSOR_COCTS    (0x01)
#define SENSOR_CZI      (0x02)
#define SENSOR_UVI      (0x04)

#define SENSOR_COCTS_STR    ("COCTS")
#define SENSOR_CZI_STR      ("CZI")
#define SENSOR_UVI_STR      ("UVI")

#define DPG_TRBMCC  (0x01)
#define DPG_TRBMC   (0x02)
#define DPG_LWRBMC  (0x04)
#define DPG_LWRBMCC (0x08)
#define DPG_RAYBMC  (0x10)

//#define FD_DEBUG        (1)
#define PATH_MAXSIZE    (512)
#define NAME_LENGTH    (8)
#define MAX_WAVE        (8)

#define INVALID_DATA

#include "ini.h"

#ifdef __cplusplus
extern "C" {
#endif
#include "l12_proto.h"
#ifdef __cplusplus
}
#endif

typedef enum {
        FILTER_BASE_TYPE_MID = 1,
        FILTER_BASE_TYPE_MAX_FREQUENCY = 2,
}FILTER_BASE_TYPE;

typedef struct _calc_again_t
{
    int calc_again;
    int keep_original_gain;
    float gain[2];
}calc_again_t;

typedef struct _gloabl_config
{
    int sensor_id;
    char sensor[NAME_LENGTH];

    int DPG_method;
    char DPG_method_str[NAME_LENGTH];

    FILE * pLog;
    LogLevel_em log_level;

    char hy1c_f[PATH_MAXSIZE];
    char modis_f[PATH_MAXSIZE];
    char config_f[PATH_MAXSIZE];
    char out_gain[PATH_MAXSIZE];

    float wave_hy1c[MAX_WAVE];
    int hy1c_nwave;

    float wave_modis[MAX_WAVE];
    int modis_nwave;

    char aermodules[100][32];
    int naermodules;
    char aerosol_LUT[NAME_LENGTH]; // cocts hico

    /* configurations from configuration file */
    int trbmc_region;

    FILTER_BASE_TYPE filter_base_type;

    /* structure to store aerosol values  */
    aestr   aerec;
    /* input parameters structure         */
    instr   input;

    calc_again_t again;

    int mode;
    int model_number_base;
}global_config;

extern global_config g_cfg;

int init_cfg(int argc, char* argv[]);
